#include <stdint.h>
#include "systick.h"
#include "wifi_drv.h"
#include "lcd_drv.h"
#include "hmi_app.h"
#include "wifi_app.h"
#include "RTT_Debug.h"
#include "iap_drv.h"
#include "store_app.h"
#include "inflash_drv.h"
#include "delay.h"

static void DrvInit(void)
{
	DelayInit();
	SystickInit();
	WifiModuleDrvInit();
	LcdDrvInit();
}

static void AppInit(void)
{
	InitSysParam();
	OtaInit();
}

int main(void)
{	
	DrvInit();
	AppInit();
	
	while (1)
	{
		HmiTask();
		if (CheckNeedUpdate())
		{
			UpdateApp();
		}
		else
		{
			LcdArea_t area = {0, 0, 239, 399};
			LcdFillPureColor(&area, WHITE);  
			DBG_log("*********boot to app***********\n");
			BootToApp();
		}
	}
}


